package com.qfedu.buy.server.controller;

import com.qfedu.buy.common.config.SystemConfig;
import com.qfedu.buy.server.entity.Usersign;
import com.qfedu.buy.server.service.intf.UsersignService;
import com.qfedu.buy.server.vo.R;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: NeighborBuy
 * @description: 邻里购真正意义上最懂你的新零售平台
 * @author: Feri(老邢)
 * @create: 2021-01-26 14:22:27
 */
@RestController
@RequestMapping("api/usersign/")
public class UsersignController{
    /*
    *注入业务逻辑层对象*/
    @Autowired
    private UsersignService service;
    /*
    * 新增内容*/

    @PostMapping("save.do")
    public R save(@RequestBody Usersign usersign){
       return service.save(usersign);
    }
    /*
    * 查询 所有数据*/
    @GetMapping("all.do")
    public R all(){
       return service.queryAll();
    }

    @GetMapping("checksign.do")
    public R check(HttpServletRequest request){
        return service.checkSign(request.getHeader(SystemConfig.TOKEN_HEADER));
    }

    @GetMapping("sign.do")
    public R sign(HttpServletRequest request){
        return service.sign(request.getHeader(SystemConfig.TOKEN_HEADER));
    }
}